﻿using HRMSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HRMSystem.DBServices
{
    public class BranchService : GenericService<Branch>
    {
        internal static List<Branch> GetAllBranchesByCompanyId(int companyId)
        {
            try
            {
                return db.Branches.Where(b => b.COMPANY_ID == companyId && b.ISDELETE == false).ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        internal static Branch GetBranchByBranchId(int branchId)
        {
            try
            {
                return db.Branches.SingleOrDefault(b => b.ID == branchId && b.ISDELETE == false);
            }
            catch (Exception)
            {
                return null;
            }
        }
    }
}
